package com.njlime.cms.repository.app;

import com.njlime.cms.entities.MaterialsNews;
import com.njlime.core.base.repository.impl.BaseDaoImpl;
import com.njlime.core.helper.PageBean;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Repository
public class AppMaterialNewsDaoImpl extends BaseDaoImpl<MaterialsNews>{

	public Map<String,Object> get(int id){
		StringBuilder sb = new StringBuilder();
		List<Object> arrList = new ArrayList<Object>();
		sb.append(" SELECT ti.*, tu.unit_name unit_name,tu.head_url unit_img FROM t_materials_news ti ");
		sb.append("JOIN t_unit tu ON tu.id = ti.unit_id ");
		sb.append(" WHERE ti.id = ? ");
		arrList.add(id);
		List<Map<String, Object>> re = getListJdbc(sb.toString(), arrList);
		if (re != null && re.size() > 0) {
			return re.get(0);
		}
		return null;
	}

}
